home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 11 / AMUG BBS in a Box Volume XI (April 1994) (MacWizards).iso / Files / Tele / Internet / NewsWatch.sit / source / mylistdef.c / mylistdef.c
Encoding:
C/C++ Source or Header  |  1991-04-03  |  1.9 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*----------------------------------------------------------
  2. #
  3. #    NewsWatcher    - Macintosh NNTP Client Application
  4. #
  5. #    Written by Steven Falkenburg
  6. #    ©1990 Apple Computer, Inc.
  7. #
  8. #-----------------------------------------------------------
  9. #
  10. #    mylistdef.c
  11. #
  12. #    This module contains the LDEF which will be compiled and
  13. #    linked into the rest of the NewsWatcher application.
  14. #
  15. #-----------------------------------------------------------*/
  16.  
  17. #include <Types.h>
  18. #include <QuickDraw.h>
  19. #include <Packages.h>
  20. #include <Lists.h>
  21. #include <SysEqu.h>
  22. #include <ToolUtils.h>
  23.  
  24.  
  25. /*    This is the list definintion used for all list manager lists in
  26.     NewsWatcher.  This list def allows for bold text, and will automatically
  27.     narrow text lines which wouldn't otherwise fit across the list.
  28. */
  29.  
  30. pascal void    main(short lMessage,Boolean lSelect,Rect *lRect,Cell lCell,short lDataOffset,short lDataLen,ListHandle lHandle)
  31. {
  32.     #pragma unused (lCell)
  33.     
  34.     FontInfo fontInfo;
  35.     short face;
  36.     
  37.     switch (lMessage) {
  38.       case lInitMsg:
  39.           break;
  40.  
  41.       case lDrawMsg:
  42.           if (lDataLen > 0) {
  43.             EraseRect(lRect);
  44.             GetFontInfo(&fontInfo);
  45.             MoveTo(lRect->left+(**lHandle).indent.h,lRect->top+fontInfo.ascent);
  46.             HLock( (Handle) (**lHandle).cells );
  47.             
  48.             face = 0;
  49.             if ( (unsigned char) *((*((**lHandle).cells))+lDataOffset+lDataLen-1) == 0xff ) {
  50.                 lDataLen--;
  51.                 face = 0;
  52.             }
  53.             else
  54.                 face |= bold;
  55.             (**lHandle).port->txFace = face;
  56.             if (TextWidth( (Ptr) (*((**lHandle).cells)),lDataOffset,lDataLen-1) > (lRect->right-lRect->left-(**lHandle).indent.h))
  57.                 face |= condense;
  58.  
  59.             (**lHandle).port->txFace = face;
  60.             DrawText( (Ptr) (*((**lHandle).cells)),lDataOffset,lDataLen-1);
  61.             HUnlock( (Handle) (**lHandle).cells );
  62.           }
  63.           else
  64.               EraseRect(lRect);
  65.  
  66.         /* stop if no selection is needed */
  67.         if (!lSelect)
  68.               break;
  69.  
  70.       case lHiliteMsg:
  71.           BitClr((Ptr)HiliteMode,pHiliteBit);
  72.           InvertRect(lRect);
  73.           break;
  74.  
  75.       case lCloseMsg:
  76.           break;
  77.     }
  78. }
  79.  
  80.